import { BasicColumn, FormSchema } from '@/components/Table';
import { h } from 'vue';
import { Tag } from 'ant-design-vue';
import Icon from '@/components/Icon/Icon.vue';
import { categoryList,teamSelectList } from '@/api/heng/ex';

export const columns: BasicColumn[] = [
  {
    title: '分类名称',
    dataIndex: 'categoryName',
    align: 'left',
  },
  {
    title: '团队部门',
    dataIndex: 'teamName',
    width: 200,
  },
  {
    title: '排序',
    dataIndex: 'sort',
    width: 50,
  },

  {
    title: '创建时间',
    dataIndex: 'createTime',
    width: 180,
  },
];

const isDir = (type: string) => type === '0';
const isMenu = (type: string) => type === '1';
const isButton = (type: string) => type === '2';

export const searchFormSchema: FormSchema[] = [
  {
    field: 'categoryName',
    label: '分类名称',
    component: 'Input',
    colProps: { span: 8 },
  },
  // {
  //   field: 'status',
  //   label: '状态',
  //   component: 'Select',
  //   componentProps: {
  //     options: [
  //       { label: '启用', value: 1 },
  //       { label: '停用', value: 0 },
  //     ],
  //   },
  //   colProps: { span: 8 },
  // },
];

export const formSchema: FormSchema[] = [
  {
    field: 'deptId',
    label: 'deptId',
    // ifShow: ({ values }) => values.hideMenu == 1,
  },
  {
    field: 'pid',
    label: '上级分类',
    slot: 'pid',

  },
  {
    field: 'teamId',
    label: '团队部门',
    required: false,
    component: 'ApiSelect',
    componentProps: {
      resultField: 'data',
      labelField: 'deptName',
      valueField: 'teamId',
      params: { status: 1 },
      api: teamSelectList,
    },
    ifShow: ({ values }) => values.pid==0||!values.pid,

  },
  {
    field: 'categoryName',
    label: '分类名称',
    component: 'Input',
    required: true,
  },


  {
    field: 'sort',
    label: '排序',
    component: 'InputNumber',
    required: true,
  },

  {
    field: 'difficultyLevel',
    label: '难度等级',
    component: 'Select',
    componentProps: {
      options: [
        { label: '低', value: 1 },
        { label: '中', value: 2 },
        { label: '高', value: 3 },

      ],
    },
    required: false,
    ifShow: ({ values }) => values.pid,
  },
];
